home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / gui / gui4cli.lha / Gui4Cli / Ext / GCView / gcScala.gc next >
Encoding:
Gui4CLI script  |  1999-11-12  |  7.5 KB  |  313 lines

  1. G4C
  2.  
  3. ; Show a Scala event (without sounds, wipes etc)
  4. ; -----------------------------------------------------------
  5. ; USE: GuiLoad Path:gcScala.gc GUI ID EventLine
  6.  
  7. ; - GUI          : The name of the gui containing the listview
  8. ; - ID          : The ID of the listview holding the script
  9. ; - EventLine : The line number where the event starts
  10. ; -----------------------------------------------------------
  11.  
  12. xOnLoad gui id evline
  13.     ; Start up gcview - if it's already running, clear it
  14.     ; and do not set the RMB notify
  15.     ifexists port ~gcview
  16.         run 'guis:ext/gcview/gcview'
  17.         wait port gcview 100
  18.         if $$retcode > 0
  19.             ezreq 'Could not start GCView' Abort ''
  20.             guiquit #this
  21.             stop
  22.         endif
  23.         call gcview notify RMB 'Gui4Cli' 'gosub gcScala.gc quit'
  24.         IStartedGCV = 1        ; flag to quit it at end
  25.     else
  26.         call gcview unload #PIC
  27.         call gcview unload #ANIM
  28.         IStartedGCV = 0
  29.     endif
  30.  
  31.     gosub #this playevent
  32.  
  33. xOnReload gui id evline
  34.     call gcview unload #PIC
  35.     call gcview unload #ANIM
  36.     gosub #this playevent
  37.  
  38. xRoutine quit                    ; this is the routine gcview will call on RMB
  39.     if $IStartedGCV = 1        ; quit gcview if we were the ones that started it
  40.         call gcview quit force
  41.     endif
  42.     guiquit #this
  43.  
  44. ; ---------------------------------------------------------
  45. ;    PlayEvent    - Main routine to load & play event
  46. ; ---------------------------------------------------------
  47.  
  48. xRoutine PlayEvent
  49.  
  50.     Remap      = OFF                    ; default attribute settings
  51.     APen      = 2
  52.     BPen      = 1
  53.     PenMode = JAM1
  54.     call gcview unload mypic    ; in case it was loaded
  55.     call gcview info text aa   ; store old font name/size
  56.     font = $$call.ret
  57.     parsevar font
  58.     oldfontname = $$parse.5
  59.     oldfontsize = $$parse.1
  60.  
  61.     gosub #this ClipEvent    ; store event into our lv
  62.     lvuse #this 1
  63.  
  64.     gosub #this LoadPic        ; load BLANK, PICTURE or ANIM
  65.  
  66.     ; go through lv loading brush, font, text etc
  67.     lvgo first
  68.     while $$lv.line > ''
  69.         docase $$lv.rec[0][4]
  70.  
  71.         case = BRUS                ; BRUSH
  72.             gosub #this LoadBrush $$lv.rec
  73.             break
  74.  
  75.         case = FONT
  76.             gosub #this SetFont $$lv.rec
  77.             break
  78.  
  79.         case = PALE                ; PALETTE
  80.             call gcview set SCpalette mypic $$lv.rec[8]
  81.             break
  82.  
  83.         case = COLO                ; COLOR
  84.             gosub #this SetColor $$lv.rec
  85.             break
  86.  
  87.         case = TEXT
  88.             if $$lv.rec[4][1] = ' '     ; avoid textwipe, textout etc
  89.             and $.sced != NOTEXT ; ################### my fix !!!!!!!!!!!
  90.                 gosub #this ShowText $$lv.rec
  91.             endif
  92.             break
  93.  
  94.         case = ATTR                ; ATTRIBUTES (check for Remap/outline)
  95.             curline = $$lv.rec
  96.             searchvar curline "edge" ci first
  97.             if $$search.pos != ''
  98.                 PenMode = OUTLINE
  99.             else
  100.                 PenMode = JAM1
  101.             endif
  102.             searchvar curline "remap" ci first
  103.             if $$search.pos != ''
  104.                 Remap = ON
  105.             else
  106.                 Remap = OFF
  107.             endif
  108.             break
  109.         endcase
  110.  
  111.         if $$lv.rec[0][3] == BOX        ; BOX - has only 3 letters..
  112.             gosub #this DoBox $$lv.rec
  113.         endif
  114.  
  115.         lvgo next
  116.     endwhile
  117.  
  118.     ; bring finished screen to front
  119.     call gcview open mypic
  120.     ; restore old font
  121.     call gcview set font $oldfontname $oldfontsize 000
  122.     
  123. ; ---------------------------------------------------------
  124. ;    LoadPic    - Load pic/anim, resize & open - Alias = mypic
  125. ;    Screen will be opened *behind* (so we can add to it)
  126. ; ---------------------------------------------------------
  127.  
  128. xRoutine LoadPic
  129.     local stopflag
  130.     stopflag = 0
  131.  
  132.     ; go through lv, find main item - BLANK, PICTURE or ANIM
  133.     lvuse #this 1
  134.     lvgo first
  135.  
  136.     while $$lv.line > ''
  137.     and stopflag != 2                ; extra loop for resolution
  138.  
  139.         docase $$lv.rec[0][4]
  140.  
  141.         case = BLAN                    ; BLANK 640 512 4 lace hires 0
  142.             curline = $$lv.rec    ; - use only the width/height/depth
  143.             parsevar curline
  144.             call gcview create mypic $$parse.1 $$parse.2 $$parse.3
  145.             stopflag = 2
  146.             gcview.gc/type = PIC
  147.             break
  148.  
  149.         case = ANIM                    ; ANIM
  150.             curline = $$lv.rec
  151.             parsevar curline
  152.  
  153.             ifexists gui gcview.gc                ; use gcview settings if found
  154.                 gcview.gc/file = $$parse.1
  155.                 gcview.gc/type = ANIM
  156.                 if $gcview.gc/loadall == ON
  157.                     gcview.gc/loadedas = LOADALL
  158.                     if $gcview.gc/userange = 1
  159.                         call gcview anload $$parse.1 mypic $gcview.gc/start $gcview.gc/frames $gcview.gc/andir
  160.                     else
  161.                         call gcview anload $$parse.1 mypic 0 1000 $gcview.gc/andir
  162.                     endif
  163.                 else
  164.                     gcview.gc/loadedas = NORMAL
  165.                     call gcview load $$parse.1 mypic
  166.                 endif
  167.                 gosub gcview.g showinfo
  168.  
  169.             else
  170.                 call gcview anload $$parse.1 mypic 0 -1 FORWARD ; load anim
  171.             endif
  172.  
  173.             call gcview set speed mypic $$parse.2            ; anim speed
  174.             ; call gcview set loops mypic $$parse.3            ; loops (-1=forever)
  175.             stopflag = 2
  176.             break
  177.  
  178.         case = PICT                    ; PICTURE
  179.             curline = $$lv.rec
  180.             parsevar curline
  181.             call gcview load $$parse.1 mypic
  182.             stopflag = 1 ; continue, looking for resolution
  183.             gcview.gc/type = PIC
  184.             break
  185.  
  186.         case = RESO                    ; RESOLUTION (only in pictures)
  187.             curline = $$lv.rec
  188.             parsevar curline
  189.             call gcview set mode mypic 'x$$parse.4' ; viewmode is in hex
  190.             call gcview resize mypic $$parse.1 $$parse.2
  191.             stopflag = 2
  192.             break
  193.  
  194.         endcase
  195.         lvgo next
  196.     endwhile
  197.  
  198.     if $stopflag = 0        ; nothing found..
  199.         ezreq 'Could not find BLANK, PICTURE or ANIM!' Abort ''
  200.         stop
  201.     endif
  202.  
  203. ; ---------------------------------------------------------
  204. ;    LoadBrush    - Load, resize/Remap, paste & free Brush
  205. ; ---------------------------------------------------------
  206.  
  207. xRoutine LoadBrush curline
  208.  
  209.     ; BRUSH 128 134 "SQ0:name" size 163 350
  210.     parsevar curline
  211.     call gcview load $$parse.3 mybrush
  212.  
  213.     ; resize if needed
  214.     if $$parse.4 == 'size'
  215.         call gcview resize mybrush $$parse.5 $$parse.6
  216.     endif
  217.  
  218.     ; paste brush
  219.     if $Remap = ON
  220.         call gcview paste mybrush mypic $$parse.1 $$parse.2 Remap
  221.     else
  222.         call gcview paste mybrush mypic $$parse.1 $$parse.2
  223.     endif
  224.     
  225.     call gcview unload mybrush ; no longer needed
  226.  
  227. ; ---------------------------------------------------------
  228. ;    SetFont        - Set the current font to use
  229. ; ---------------------------------------------------------
  230.  
  231. xRoutine SetFont curline
  232.     local fsize
  233.  
  234.     ; FONT Scala.font 20 11 ->> 20=??, 11=size (always last)
  235.     parsevar curline
  236.     if $$parse.tot = 4
  237.         fsize = $$parse.3
  238.     else
  239.         fsize = $$parse.2
  240.     endif
  241.  
  242.     call gcview set font $$parse.1 $fsize 000
  243.  
  244. ; ---------------------------------------------------------
  245. ;    SetColor        - 1st num = text color, 2nd=outline color
  246. ; ---------------------------------------------------------
  247.  
  248. xRoutine SetColor curline
  249.  
  250.     ; COLOR 13 1 2 13 2 0 1 0 0 1 1 2 2 1 1
  251.     parsevar curline
  252.     APen = $$parse.1
  253.     BPen = $$parse.2
  254.  
  255. ; ---------------------------------------------------------
  256. ;    ShowText        - TEXT 285 224 "text"
  257. ; ---------------------------------------------------------
  258.  
  259. xRoutine ShowText curline
  260.  
  261.     call gcview set pens $APen $BPen $PenMode     ; set the pens
  262.  
  263.     parsevar curline
  264.     call gcview text mypic $$parse.1 $$parse.2 $$parse.3
  265.  
  266. ; ---------------------------------------------------------
  267. ;    DoBox            - BOX l t w h
  268. ; ---------------------------------------------------------
  269.  
  270. xRoutine DoBox curline
  271.  
  272.     call gcview set pens $APen $BPen $PenMode     ; set the pens
  273.  
  274.     parsevar curline
  275.     call gcview rect mypic $$parse.1 $$parse.2 $$parse.3 $$parse.4
  276.  
  277. ; ---------------------------------------------------------
  278. ;    ClipEvent - put event into our lv so we handle it easier
  279. ; ---------------------------------------------------------
  280.  
  281. xRoutine ClipEvent
  282.  
  283.     lvuse $gui $id
  284.     lvgo    #$evline
  285.     if $$lv.rec[0][5] != 'EVENT'
  286.         ezreq 'Could not find event\nat line $evline' Abort ''
  287.         stop
  288.     endif
  289.  
  290.     ; count No of lines till end of event
  291.     count = 0
  292.     while $$lv.line > ''
  293.     and $$lv.rec[0][3] != END
  294.         lvgo next
  295.         ++count
  296.     endwhile
  297.     
  298.     ; clip the lines into our own lv
  299.     lvgo #$evline
  300.     lvclip copy $count paste #this 1
  301.  
  302. ; ---------------------------------------------------------
  303. ;    temp lv to hold the event
  304. ; ---------------------------------------------------------
  305.  
  306. xListview 0 0 0 0 '' var '' 0 NUM
  307. gadid 1
  308.  
  309.  
  310.  
  311.  
  312.  
  313.